﻿using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

namespace ClientInfrastructure.Model
{
    public class NavigationViewItemWithAuth
    {
        //为0时表示不限制
        public int FunCode { get; set; }
        public string Name { get; set; } = "";
        public Type? TargetPageType { get; set; }
        public String? Icon { get; set; }
        public bool IsSymbolRegularIcon { get; set; } = true;
        public bool IsNavigation { get; set; } = true;
        public List<NavigationViewItemWithAuth> Sons { set; get; } = new List<NavigationViewItemWithAuth>();


        public NavigationViewItemWithAuth(int funCode, Type targetPageType)
        {
            this.FunCode = funCode;
            TargetPageType = targetPageType;
        }
        public NavigationViewItemWithAuth(string name, Type targetPageType)
        : this(0, targetPageType)
        {
            Name = name;
        }
        public NavigationViewItemWithAuth(int funCode, string name, Type targetPageType, bool isNavigation): this(funCode, name, targetPageType)
        {
            this.IsNavigation = isNavigation;
        }
        public NavigationViewItemWithAuth(int funCode, string name, Type targetPageType)
            : this(funCode, targetPageType)
        {
            Name = name;
        }

        public NavigationViewItemWithAuth(int funCode, string name, String icon, Type targetPageType)
            : this(funCode, name, targetPageType)
        {
            Icon = icon;
        }
        public NavigationViewItemWithAuth(int funCode, string name, String icon, bool isSymbolRegularIcon = true)
        {
            this.FunCode = funCode;
            Name = name;
            Icon = icon;
            IsSymbolRegularIcon = isSymbolRegularIcon;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="name"></param>
        /// <param name="icon">SymbolRegularIcon</param>
        /// <param name="menuItems"></param>
        public NavigationViewItemWithAuth(int funCode, string name, String icon, List<NavigationViewItemWithAuth> menuItems)
            : this(funCode, name, icon, true)
        {
            Sons = menuItems;
        }

        public NavigationViewItemWithAuth(int funCode, string name, String icon, bool isSymbolRegularIcon, Type targetPageType)
            : this(funCode, name, icon, isSymbolRegularIcon)
        {
            TargetPageType = targetPageType;
        }

        public NavigationViewItemWithAuth(int funCode, string name, String icon, bool isSymbolRegularIcon, List<NavigationViewItemWithAuth> menuItems)
            : this(funCode, name, icon, isSymbolRegularIcon)
        {
            Sons = menuItems;
        }
    }
}
